package main

import (
	"log"
	"net/http"
	"fmt"
	"os"
)

func sayhelloName(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "HeroKu") //这个写入到w的是输出到客户端的
}

func main() {
	log.Println("Start Server")
	port := os.Getenv("PORT")
	if port == "" {
		port = "80"
	}
	http.HandleFunc("/", sayhelloName)       //设置访问的路由
	err := http.ListenAndServe(":"+port, nil) //设置监听的端口
	if err != nil {
		log.Fatal("ListenAndServe: ", err)
	}
	log.Println("Started Server")
}
